package cn.aj.exm.feign;

import cn.aj.exm.fallback.MovieServiceFallbackFactory;
import cn.aj.exm.result.JsonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(name = "service-movie", contextId = "movieService", path = "movie", fallbackFactory = MovieServiceFallbackFactory.class)
public interface MovieService {

    @RequestMapping(value = "/list",method = RequestMethod.GET)
    JsonResult list();

    @RequestMapping(value = "/{id}",method = RequestMethod.GET)
    JsonResult get(@PathVariable("id")Long id);

    @RequestMapping(value = "/buyMovieTicket{movieId}/{count}",method = RequestMethod.GET)
    JsonResult buyTicket(@PathVariable("movieId") Long movieId, @PathVariable("count")Integer count);

    @RequestMapping(value = "/sendMovieTicket{movieId}/{count}/{userId}",method = RequestMethod.GET)
    JsonResult sendMovieTicket(@PathVariable("movieId") Long movieId, @PathVariable("count")Integer count, @PathVariable("userId")Long userId);
}
